﻿using System;
using CodeMan.DbOther;
using CodeMan.EntityFrameworkCore.Other.DbOther;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore.SqlServer;
using Volo.Abp.FeatureManagement.EntityFrameworkCore;
using Volo.Abp.Identity.EntityFrameworkCore;
using Volo.Abp.IdentityServer.EntityFrameworkCore;
using Volo.Abp.Modularity;
using Volo.Abp.PermissionManagement.EntityFrameworkCore;
using Volo.Abp.SettingManagement.EntityFrameworkCore;
using Volo.Abp.TenantManagement.EntityFrameworkCore;

namespace CodeMan.EntityFrameworkCore.Other
{

    [DependsOn(
       typeof(CodeManDomainModule),
        //typeof(AbpIdentityEntityFrameworkCoreModule),
        //typeof(AbpIdentityServerEntityFrameworkCoreModule),
        //typeof(AbpPermissionManagementEntityFrameworkCoreModule),
        //typeof(AbpSettingManagementEntityFrameworkCoreModule),
        typeof(AbpEntityFrameworkCoreSqlServerModule)
        //typeof(AbpBackgroundJobsEntityFrameworkCoreModule),
        //typeof(AbpAuditLoggingEntityFrameworkCoreModule),
        //typeof(AbpTenantManagementEntityFrameworkCoreModule),
        //typeof(AbpFeatureManagementEntityFrameworkCoreModule)
       )]
    public class CodeManEntityFrameworkCoreOtherModule : AbpModule
    {
        public override void ConfigureServices(ServiceConfigurationContext context)
        {
            Configure<AbpDbConnectionOptions>(options =>
            {
                ChangeDBEven.options = options;
            });

            Configure<AbpDbContextOptions>(options =>
            {
                /* The main point to change your DBMS.
                 * See also CodeManMigrationsDbContextFactory for EF Core tooling. */
                options.UseSqlServer(o =>
                {
                  
                });
                //options.UseSqlite();
            });
            context.Services.AddAbpDbContext<CodeManOtherDbContext>(options =>
            {
                /* Remove "includeAllEntities: true" to create
                 * default repositories only for aggregate roots */
                options.AddDefaultRepositories(includeAllEntities: true);

                options.AddRepository<TableEntity, OtherDBRepository>();

            });


        }
    }
}
